<?php if(validation_errors()) : ?>
  <div class="box"><div id="box-messages">
    <div class="messages">
      <div id="message-success" class="message message-error">
        <div class="image">
          <img src="<?php echo base_url(); ?>file/shell/smooth/resources/images/icons/error.png" alt="Error" height="32" />
        </div>
        <div class="text"><?php echo validation_errors(); ?></div>
      <div class="dismiss"><a href="#message-success"></a></div>
      </div>
    </div>
  </div></div>
<?php endif; ?>
<?php
  $msg = $this->session->flashdata('message');
  $div_class = $this->session->flashdata('div_class');

  if($msg){
  echo '<div class="box"><div id="box-messages">
      <div class="messages">
        <div id="message-success" class="message message-'.$div_class.'">
          <div class="image">
            <img src="'. base_url() .'file/shell/smooth/resources/images/icons/'.$div_class.'.png" alt="'.$div_class.'" height="32" />
          </div>
          <div class="text"><h6>'. $msg .'</h6></div>
          <div class="dismiss"><a href="#message-success"></a></div>
        </div>
      </div>
    </div></div>';
  }
?>

<div class="page-title">
  <h2><?php echo $page_title; ?></h2>
</div>

<form action="<?php echo $_SERVER[ 'PHP_SELF' ] ?>" method="post" >
<div id="tabs" style="width: 99%">
  <ul>
    <li><a href="#outlet_territory">Informasi Territory</a></li>
    <li><a href="#outlet_data">Data Outlet</a></li>
    <li><a href="#outlet_pemilik">Data Pemilik</a></li>
    <li><a href="#outlet_program">Data Program</a></li>
    <?php if($this->uri->segment(2) != 'add') : ?>
    <li><a href="#outlet_frontliner">Data Frontliner</a></li>
    <!-- <li><a href="#outlet_bank">Data Bank</a></li> -->
    <li><a href="#outlet_ho">HO Program</a></li>
    <?php endif; ?>
  </ul>

  <div id="outlet_territory" >
    <?php $this->load->view('partner/outlet_territory'); ?>
  </div>
  <!-- ========================================================================================== -->
  <div id="outlet_data" >
    <?php $this->load->view('partner/outlet_data'); ?>
  </div>
  <!-- ========================================================================================== -->
  <div id="outlet_pemilik" >
    <?php $this->load->view('partner/outlet_owner'); ?>
  </div>
  <!-- ========================================================================================== -->
  <div id="outlet_program" >
    <?php $this->load->view('partner/outlet_program'); ?>
  </div>
  <?php if($this->uri->segment(2) != 'add') : ?>
  <!-- ========================================================================================== -->
  <div id="outlet_frontliner" >
    <?php $this->load->view('partner/outlet_frontliner'); ?>
  </div>
  <!-- ========================================================================================== -->
  <!-- <div id="outlet_bank" >
    
  </div> -->
  <!-- ========================================================================================== -->
  <div id="outlet_ho" >
    <?php $this->load->view('partner/outlet_category_ho'); ?>
  </div>
  <?php endif; ?>
</div>

<?php if($this->session->userdata('group') == 4 OR $this->session->userdata('group') == 5) : ?>
  <p class="tombol-simpan">
    <button type="submit">simpan</button>
    <input id="data_complete" type="checkbox" name="data_complete" value="1"> 
    <label for="data_complete">Data sudah lengkap ?</label>
  </p>
<?php endif; ?>
</form>

<script>
  $(document).ready(function() {
    var uri = "<?php echo $this->uri->segment(2); ?>";
    if(uri == 'view') {
      $('input').attr('disabled', 'disabled');
      $('textarea').attr('disabled', 'disabled');
      $('select').attr('disabled', 'disabled');
      $('.tombol-simpan').remove();
    }

    $('#tabs').tabs();
    $('.datepicker').datepicker({
      showOn: "button",
      buttonImage: "<?php echo base_url('file/shell/smooth/resources/images/icons/calendar.png') ?>",
      buttonImageOnly: true,
      dateFormat: "yy-mm-dd",
      changeMonth: true,
      changeYear: true
    });
    $('.ui-datepicker-trigger').css({'padding-left': '4px', 'margin-top': '-4px'})
  });

</script>